<template>
    <Form ref="formData" :model="formData" :rules="ruleValidate" :label-width="80">
<#list table.fields as field>
        <FormItem label="${field.comment}" prop="${field.propertyName}">
            <Input v-model="formData.${field.propertyName}" ></Input>
        </FormItem>
</#list>
        <div style="text-align: center;margin: 15px">
            <Button @click="handleReset('formData')">重置</Button>
            <Button type="primary" @click="handleSubmit('formData')" style="margin-left: 8px">保存</Button>
        </div>
        <!--加载中显示 -->
        <Spin size="large" fix v-if="spinShow"></Spin>
    </Form>
</template>

<script>
    import Base from '@/components/table/BaseEdit.vue';
    export default {
        extends:Base,
        data () {
            return {
                ruleValidate: {
                <#list table.fields as field>
                    ${field.propertyName}: [
                        { required: true, message: '请输入${field.comment}!', trigger: 'blur' },
                    ],
                </#list>
                }
            }
        },
        methods: {
            loadDataById(id){
                this.load("/api/${cfg.projectName}/${package.ModuleName}/read",{id})
            },handleSubmit (name) {
                //保存
                this.save(name,"/api/${cfg.projectName}/${package.ModuleName}/save");
            },
        }
    }
</script>

<style scoped>

</style>
